//
//  FormItemMaker.m
//  SYPerfectDemo
//
//  Created by Lssyyy on 2019/8/8.
//  Copyright © 2019年 Lssyyy. All rights reserved.
//

#import "FormItemMaker.h"

@implementation FormItemMaker
//现金券
+ (FormSectionItem *)cashCouponSectionMake{
    NSMutableArray *Items = [NSMutableArray array];
    CouponFormItem *couponTypeItem = couponItem_Add(JMLocalStr(@"类型"), @"0", nil, CouponFormItemTypeChooseCouponType, YES, YES, UIKeyboardTypeDefault);
    [Items addObject:couponTypeItem];
    
    //面值
    CouponFormItem *valueItem = couponItem_Add(JMLocalStr(@"面额"), nil, @"请输入金额", CouponFormItemTypeNormal, YES, YES, UIKeyboardTypeNumberPad);
    valueItem.itemUnitType = CouponFormItemUnitTypeYuan;
    [Items addObject:valueItem];
    
    //使用条件
    CouponFormItem *conditionItem = couponItem_Add(JMLocalStr(@"使用条件"), nil, @"请输入金额", CouponFormItemTypeNormal, YES, NO, UIKeyboardTypeNumberPad);
    conditionItem.itemUnitType = CouponFormItemUnitTypeYuan;
    [Items addObject:conditionItem];
    
    //发放总量
    CouponFormItem *numberItem = couponItem_Add(JMLocalStr(@"发放总量"), nil, @"请输入数量", CouponFormItemTypeNormal, YES, YES, UIKeyboardTypeNumberPad);
    numberItem.itemUnitType = CouponFormItemUnitTypePieces;
    [Items addObject:numberItem];
    
    //有效期
    CouponFormItem *timeLimitItem = couponItem_Add(JMLocalStr(@"有效期"), nil, @"请选择 >", CouponFormItemTypeTimeSelected, YES, YES, UIKeyboardTypeNumberPad);
    [Items addObject:timeLimitItem];
    
    //是否上架
    CouponFormItem *publishItem = couponItem_Add(JMLocalStr(@"是否上架"), @"0", nil, CouponFormItemTypeChooseIsPublish, YES, YES, UIKeyboardTypeDefault);
    [Items addObject:publishItem];
    
    FormSectionItem *sectionItem =  SectionItem(Items);
    return sectionItem;
}

+ (CouponFormItem *)replaceItemIsCash:(BOOL)isCash{
    if (isCash) {
        //面值
        CouponFormItem *valueItem = couponItem_Add(JMLocalStr(@"面额"), nil, @"请输入金额", CouponFormItemTypeNormal, YES, YES, UIKeyboardTypeNumberPad);
        valueItem.itemUnitType = CouponFormItemUnitTypeYuan;
        return valueItem;
    }else{
        //面值
        CouponFormItem *discountItem = couponItem_Add(JMLocalStr(@"打折"), nil, @"请输入折扣值", CouponFormItemTypeNormal, YES, YES, UIKeyboardTypeNumberPad);
        discountItem.itemUnitType = CouponFormItemUnitTypeNone;
         return discountItem;
    }
}
@end
